/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Test
 * Date: 2023-02-27
 * Time: 10:04
 */
public class L {

    public static void main(String[] args) {
        /*int a = 20;
        if(a % 2 == 0){
            System.out.println("偶数");
        }else {
            System.out.println("奇数");
        }*/
        int year = 2022;
        if(year % 100 == 0){
            //世纪闰年
            if(year % 400 == 0){
                System.out.println("世纪闰年");
            } else{
                System.out.println("不是闰年");
            }
        } else{
            //普通闰年
            if(year % 4 == 0){
                System.out.println("普通闰年");
            } else{
                System.out.println("不是闰年");
            }
        }
        /*if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
            System.out.println("是闰年");
        }else {
            System.out.println("不是闰年");
        }*/
        /*int a = 10;
        if(a == 20);
        //此时执行这段代码 已经没有条件了
        {
            System.out.println("haha!");
        }*/
        /*int x = 10;
        int y = 10;
        if (x == 10) {
            if (y == 10) {
                System.out.println("aaa");
            }else {
                System.out.println("bbb");
            }
        }*/
    }
    public static void main10(String[] args) {
        System.out.println("1");
        System.out.println("3");
        System.out.println("2");
        int a = 10;
        if(a == 1) {
            System.out.println("a==1");
        }else if(a == 5){
            System.out.println("a == 5");
        }else {
            System.out.println("a != 1 && a != 5");
        }
    }

    public static void main9(String[] args) {
       /* int a = 10;
        int b = 20;*/
        //System.out.println(a = b);//判断相等是两个等号
        //                  true < 5
        //System.out.println(a < b != false);
        //                  true  != false
        // System.out.println(10 > 20 || 10 / 0 == 0);
        //System.out.println(10 > 20 & 10 / 0 == 0); // 程序抛出异常
        //System.out.println(10 < 20 | 10 / 0 == 0); // 程序抛出异常

        /*System.out.println(10 < 20 & 1 > 0);
        System.out.println(10 < 20 | 1 > 0);*/

        //位运算符
        /*int a = -1;
        System.out.println(a >>> 1);
*/
        int a = 10;
        int b = 20;
        int max = a > b ? a : b;
        System.out.println(max);
        boolean flg2 = true == true ? false : (true == true ? true : false);
        System.out.println(flg2);
        /*int a = 10;
        int b = 20;
        double c = a > b? 1 : 2.0;

        int d = (a + b) * 5;*/
    }

    public static void main8(String[] args) {
        int a = 1;
        int b = 2;
       /* System.out.println(a == 1 && b == 2); // 左为真 且 右为真 则结果为真
        System.out.println(a == 1 && b > 100); // 左为真 但 右为假 则结果为假
        System.out.println(a > 100 && b == 2); // 左为假 但 右为真 则结果为假
        System.out.println(a > 100 && b > 100); // 左为假 且 右为假 则结果为假*/

        System.out.println(a == 1 || b == 2); // 左为真 且 右为真 则结果为真
        System.out.println(a == 1 || b > 100); // 左为真 但 右为假 则结果也为真
        System.out.println(a > 100 || b == 2); // 左为假 但 右为真 则结果也为真
        System.out.println(a > 100 || b > 100); // 左为假 且 右为假 则结果为假
    }

    public static void main7(String[] args) {
        /*int a = 10;
        System.out.println(!a);*/
        int a = 10;
        int b = 20;
        System.out.println(a>b);
        System.out.println(a>=b);
        System.out.println(a<=b);
        System.out.println(a==b);
        System.out.println(a!=b);
    }

    public static void main6(String[] args) {
        int a = 1;
        a += 1;
        System.out.println(a);
        int b = 10;
        long c = 20;
        b += c;
        System.out.println(b);
    }

    public static void main5(String[] args) {
        System.out.println(10%3);
        System.out.println(-10%3);
        System.out.println(10%-3);
        System.out.println(-10%-3);
        System.out.println(11.5%2);
    }

    public static void main4(String[] args) {
        System.out.println(7/3);
        System.out.println(-7/3);
        System.out.println(-7/-3);
        System.out.println(7/-3);
    }

    public static void main3(String[] args) {
        int a = 10;
        String str1 = String.valueOf(a); //int类型转换成字符串类型
        System.out.println(str1);
        String str2 = a + "";
        System.out.println(str2);//当字符串和其他类型进行相加的时候，结果就是字符串
        int c = 10;
        int d = 20;
        String str3 = "c = " + c + " d = " + d;
        String str4 = c + d + "hello";
        String str5 = "hello" + c + d;
        System.out.println(str3);
        System.out.println(str4);
        System.out.println(str5);

        System.out.println("=========");

        String str6 = "12345";
        int ret = Integer.parseInt(str6);
        System.out.println(ret);

    }

    public static void main2(String[] args) {
        String s1 = "hello";
        String s2 = "world";
        System.out.println(s1+s2);
        System.out.println("\\\"hello\\\"");
        double x= 2.0;
        int y = 4;
        x /= ++y;
        System.out.println(x);
        /*int a = 3;
        byte b = a;*/
    }

    public static void main1(String[] args) {
        boolean fag = true;
        /*int a = 0;
        *//*a = fag;
        fag = a;*/
        /*int a = 10;
        long b = 20L;
        int c = a + b; //编译出错: a + b==》int + long--> long + long 赋值给int时会丢失数据
        long d = a + b;*/
        /*byte a = 10;
        byte b = 20;*/
        /*byte c = a + b;
        byte d = (byte)(a + b);*/
        /*byte a=10;
        int b=-a;*/
        //int a =（int）8846.0;
    }
}
